home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / dev_lib / lib_com / portab.h < prev   
C/C++ Source or Header  |  1993-04-02  |  11KB  |  249 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /* PORTAB.H                                                                  */
  4. /*                                                                           */
  5. /* Use of this file may make your code compatible with all C compilers       */
  6. /* listed.                                                                   */
  7. /*                                                                           */
  8. /*****************************************************************************/
  9.  
  10. /*****************************************************************************/
  11. /* ENVIRONMENT                                                               */
  12. /*****************************************************************************/
  13.  
  14. #ifndef __PORTAB__
  15. #define __PORTAB__
  16.  
  17. #define GEMDOS     1                          /* Digital Research GEMDOS     */
  18. #define MSDOS      0                          /* Microsoft MSDOS             */
  19. #define OS2        0                          /* Microsoft OS/2              */
  20. #define FLEXOS     0                          /* Digital Research FlexOS     */
  21. #define UNIX       0                          /* Unix Operating System       */
  22.  
  23. #define M68000     1                          /* Motorola Processing Unit    */
  24. #define I8086      0                          /* Intel Processing Unit       */
  25.  
  26. #define DR_C       0                          /* Digital Research C Compiler */
  27. #define LASER_C    0                          /* Laser C Compiler            */
  28. #define LATTICE_C  0                          /* Lattice C Compiler          */
  29. #define MW_C       0                          /* Mark Williams C Compiler    */
  30. #define TURBO_C    1                          /* Turbo C Compiler            */
  31. #define MS_C       0                          /* Microsoft C Compiler        */
  32. #define HIGH_C     0                          /* Metaware High C Compiler    */
  33. #define PCC        0                          /* Portable C-Compiler         */
  34. #define XL_C       0                          /* AIX C-Compiler/6000         */
  35.  
  36. #define GEM1       0x0001                     /* ATARI GEM version           */
  37. #define GEM2       0x0002                     /* MSDOS GEM 2.x versions      */
  38. #define GEM3       0x0004                     /* MSDOS GEM/3 version         */
  39. #define XGEM       0x0100                     /* OS/2,FlexOS X/GEM version   */
  40.  
  41. #ifndef GEM
  42. #if GEMDOS
  43. #define GEM        GEM1                       /* GEMDOS default is GEM1      */
  44. #endif /* GEMDOS */
  45.  
  46. #if MSDOS
  47. #define GEM        GEM3                       /* MSDOS default is GEM3       */
  48. #endif /* MSDOS */
  49.  
  50. #if OS2
  51. #define GEM        XGEM                       /* OS/2 default is X/GEM       */
  52. #endif /* MSDOS */
  53.  
  54. #if FLEXOS | UNIX
  55. #define GEM        XGEM                       /* FlexOS default is X/GEM     */
  56. #endif /* FLEXOS */
  57. #endif /* GEM */
  58.  
  59. #undef GEM
  60. /*****************************************************************************/
  61. /* STANDARD TYPE DEFINITIONS                                                 */
  62. /*****************************************************************************/
  63.  
  64. #define BYTE    char                          /* Signed byte                 */
  65. #define CHAR    char                          /* Signed byte                 */
  66. #define UBYTE   unsigned char                 /* Unsigned byte               */
  67. #define UCHAR   unsigned char                 /* Unsigned byte               */
  68.  
  69. #if LATTICE_C | PCC | XL_C
  70. #define WORD    short                         /* Signed word (16 bits)       */
  71. #define SHORT   short                         /* Signed word (16 bits)       */
  72. #define UWORD   unsigned short                /* Unsigned word               */
  73. #define USHORT  unsigned short                /* Signed word (16 bits)       */
  74. #else
  75. #define WORD    int                           /* Signed word (16 bits)       */
  76. #define SHORT   int                           /* Signed word (16 bits)       */
  77. #define UWORD   unsigned int                  /* Unsigned word               */
  78. #define USHORT  unsigned int                  /* Signed word (16 bits)       */
  79. #endif
  80.  
  81. #define LONG    long                          /* Signed long (32 bits)       */
  82. #define ULONG   unsigned long                 /* Unsigned long               */
  83.  
  84. #define BOOLEAN WORD                          /* 2 valued (true/false)       */
  85. #define BOOL    BOOLEAN                       /* 2 valued (true/false)       */
  86.  
  87. #define FLOAT   float                         /* Single precision float      */
  88. #define DOUBLE  double                        /* Double precision float      */
  89.  
  90. #define INT     int                           /* A machine dependent int     */
  91. #define UINT    unsigned int                  /* A machine dependent uint    */
  92.  
  93. #define REG     register                      /* Register variable           */
  94. #define AUTO    auto                          /* Local to function           */
  95. #define EXTERN  extern                        /* External variable           */
  96. #define LOCAL   static                        /* Local to module             */
  97. #define MLOCAL  LOCAL                         /* Local to module             */
  98. #define GLOBAL                                /* Global variable             */
  99.  
  100. /*****************************************************************************/
  101. /* COMPILER DEPENDENT DEFINITIONS                                            */
  102. /*****************************************************************************/
  103.  
  104. #if GEMDOS                                    /* GEMDOS compilers            */
  105. #if DR_C
  106. #define void WORD                             /* DR_C doesn't know void      */
  107. #endif /* DR_C */
  108.  
  109. #if LASER_C | LATICE_C | TURBO_C
  110. #define vqt_font_info vqt_fontinfo            /* Wrong GEM binding           */
  111. #define graf_mbox graf_movebox                /* Wrong GEM binding           */
  112. #define graf_rubbox graf_rubberbox            /* Wrong GEM binding           */
  113. #endif /* LASER_C */
  114.  
  115. #if MW_C
  116. #define VOID WORD                             /* MW_C doesn't know (void *)  */
  117. #endif /* MW_C */
  118.  
  119. #if LATTICE_C
  120. #define ADR(A) (LONG)A >> 16, (LONG)A & 0xFFFF
  121. #else
  122. #define ADR(A) (WORD)((LONG)A >> 16), (WORD)((LONG)A & 0xFFFF)
  123. #endif /* LATTICE_C */
  124. #endif /* GEMDOS */
  125.  
  126. #if MSDOS | OS2                               /* MSDOS or OS2 compilers      */
  127. #define ADR(A) (WORD)((LONG)A & 0xFFFF), (WORD)((LONG)A >> 16)
  128. #endif /* MSDOS */
  129.  
  130. #if FLEXOS                                    /* FlexOS compilers            */
  131. #define ADR(A) (WORD)((LONG)A & 0xFFFF), (WORD)((LONG)A >> 16)
  132. #endif /* FLEXOS */
  133.  
  134. #if MS_C | TURBO_C | HIGH_C                   /* ANSI compilers              */
  135. #define ANSI 1
  136. #define _(params) params                      /* Parameter checking          */
  137. #else
  138. #define ANSI 0
  139. #define _(params) ()                          /* No parameter checking       */
  140. #define const
  141. #define volatile
  142. #if DR_C | LASER_C | LATTICE_C | MW_C
  143. #define size_t UINT
  144. #endif
  145. #endif
  146.  
  147. #if DR_C | LASER_C | LATTICE_C | MW_C | HIGH_C | PCC | XL_C
  148. #define cdecl
  149. #define pascal
  150. #endif
  151.  
  152. #define CONST    const
  153. #define VOLATILE volatile
  154. #define CDECL    cdecl
  155. #define PASCAL   pascal
  156.  
  157. #define SIZE_T   size_t
  158.  
  159. #ifndef VOID
  160. #define VOID     void
  161. #endif
  162.  
  163. /*****************************************************************************/
  164. /* OPERATING SYSTEM DEPENDENT DEFINITIONS                                    */
  165. /*****************************************************************************/
  166.  
  167. #if GEMDOS | UNIX
  168. #define NEAR                                  /* Near pointer                */
  169. #define FAR                                   /* Far pointer                 */
  170. #define HUGE                                  /* Huge pointer                */
  171. #else
  172. #if HIGH_C
  173. #define NEAR   _near                          /* Near pointer                */
  174. #define FAR    _far                           /* Far pointer                 */
  175. #define HUGE   _huge                          /* Huge pointer                */
  176. #else
  177. #define NEAR    near                          /* Near pointer                */
  178. #define FAR     far                           /* Far pointer                 */
  179. #define HUGE    huge                          /* Huge pointer                */
  180. #endif /* HIGH_C */
  181. #endif /* GEMDOS */
  182.  
  183. #if MSDOS | OS2 | FLEXOS                      /* MSDOS or OS2 compilers      */
  184. #define FPOFF(a)  (UWORD)(a)
  185. #define FPSEG(a)  ((UWORD)((ULONG)(a) >> 16))
  186. #define MKFP(a,b) ((VOID FAR *)(((ULONG)(a) << 16) | (UWORD)(b)))
  187. #endif /* MSDOS | OS2 | FLEXOS */
  188.  
  189. #if FLEXOS                                    /* FlexOS compilers            */
  190. #define main GEMAIN                           /* Because of X/GEM SRTL       */
  191. #endif /* FLEXOS */
  192.  
  193. #if GEM & GEM1
  194. #define appl_bvset(bvdisk, bvhard)
  195. #define appl_yield() evnt_timer (0, 0)
  196. #define menu_unregister(mid)
  197. #define scrp_clear()
  198. #define xgrf_stepcalc(orgw, orgh, xc, yc, w, h, pcx, pcy, pcnt, pxstep, pystep)
  199. #define xgrf_2box(xc, yc, w, h, corners, cnt, xstep, ystep, doubled)
  200. #endif /* GEM1 */
  201.  
  202. #if GEM & (GEM1 | XGEM)
  203. #define shel_rdef(lpcmd, lpdir)
  204. #define shel_wdef(lpcmd, lpdir)
  205. #endif /* GEM1 | XGEM */
  206.  
  207. #if GEM & (GEM1 | GEM2)
  208. #define menu_click(click, setit)
  209. #define v_copies(handle, count)
  210. #define v_etext(handle, x, y, string, offsets)
  211. #define v_orient(handle, orientation)
  212. #define v_tray(handle, tray)
  213. #define v_xbit_image(handle, filename, aspect, x_scale, y_scale, h_align, v_align, rotate, background, foreground, xy)\
  214.         v_bit_image (handle, filename, aspect, x_scale, y_scale, h_align, v_align, xy)
  215. #define vst_ex_load_fonts(handle, select, font_max, font_free)\
  216.         vst_load_fonts   (handle, select)
  217. #endif /* GEM1 | GEM2 */
  218.  
  219. #if GEM & (GEM2 | GEM3 | XGEM)
  220. #define fsel_exinput(pipath, pisel, pbutton, plabel)\
  221.         fsel_input  (pipath, pisel, pbutton)
  222. #define wind_new()
  223. #endif /* GEM2 | GEM3 | XGEM */
  224.  
  225. /*****************************************************************************/
  226. /* MISCELLANEOUS DEFINITIONS                                                 */
  227. /*****************************************************************************/
  228.  
  229. #ifndef FALSE
  230. #define FALSE   (BOOLEAN)0                    /* Function FALSE value        */
  231. #define TRUE    (BOOLEAN)1                    /* Function TRUE  value        */
  232. #endif
  233.  
  234. #define FAILURE (-1)                          /* Function failure return val */
  235. #define SUCCESS 0                             /* Function success return val */
  236. #define FOREVER for (;;)                      /* Infinite loop declaration   */
  237. #define EOS     '\0'                          /* End of string value         */
  238.  
  239. #ifndef NULL
  240. #define NULL    0L                            /* Null long value             */
  241. #endif
  242.  
  243. #ifndef EOF
  244. #define EOF     (-1)                          /* EOF value                   */
  245. #endif
  246.  
  247. #endif /* __PORTAB__ */
  248.  
  249.